var user = {
    vueInfo: null,
    URL: {
        getMyQRCodeUrl: "/api/userInfo/getMyQRCode",
        loginOutUrl: "/api/userInfo/loginOut",
    },
    detail: {
        getUserInfo: function () {
            $.post(user.URL.getMyQRCodeUrl, {}, function (data) {
                if (!data.hasError) {
                    user.vueInfo = new Vue({
                        el: "#all",
                        data: {
                            imgUrl: "http://img.si0086.com/",
                            userInfo: data.object,
                        },
                        mounted: function () {
                            winInit();
                            $.pop.load(false, null);
                        },
                        methods: {
                            loginOut: function () {
                                user.detail.loginOut();
                            }
                        }
                    });
                } else {
                    $.pop.tips(data.error);
                    if (data.errType != null) {
                        if (data.errType == "NOSESSION") {
                            setTimeout(function () {
                                window.location.href = data.errUrl;
                                return false;
                            }, 400);
                        }
                    }
                }
            }, "json").error(function (XMLHttpRequest, textStatus, errorThrown) {
                $.pop.load(false, null);
                $.pop.tips("系统繁忙，请稍后" + XMLHttpRequest.status + "," + XMLHttpRequest.readyState + "," + textStatus);
            });
        },
        loginOut: function () {
            $.pop.load(true, "loading...");
            $.post(user.URL.loginOutUrl, {}, function (data) {
                if (!data.hasError) {
                    window.location.href = data.errUrl;
                } else {
                    window.location.href = data.errUrl;
                }
            }, "json").error(function (XMLHttpRequest, textStatus, errorThrown) {
                $.pop.load(false, null);
                $.pop.tips("系统繁忙，请稍后" + XMLHttpRequest.status + "," + XMLHttpRequest.readyState + "," + textStatus);
            });
        }
    }
}